<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .circular {
            width: 30em;
            height: 30em;
            margin: 3em auto 0;
        }

        .circular svg {
            display: block;
            overflow: visible;
        }
    </style>
</head>

<body>
    <div class="content">
        <h1>环形文字</h1>
        <div class="box">
            <div class="circular">
                circular reasoning works because
            </div>
        </div>
    </div>
    <script>
        // let el=document.getElementsByName('circular')
        $$('.circular').forEach(function (el) {
            var NS = "http://www.w3.org/2000/svg";
            var xlinkNS = "http://www.w3.org/1999/xlink";
            var svg = document.createElementNS(NS, "svg");
            var circle = document.createElementNS(NS, "path");
            var text = document.createElementNS(NS, "text");
            var textPath = document.createElementNS(NS, "textPath");
            svg.setAttribute("viewBox", "0 0 100 100");
            circle.setAttribute("d", "M0,50 a50,50 0 1,1 0,1z");
            circle.setAttribute("id", "circle");
            textPath.textContent = el.textContent;
            textPath.setAttributeNS(xlinkNS, "xlink:href", "#circle");
            text.appendChild(textPath);
            svg.appendChild(circle);
            svg.appendChild(text);
            el.textContent = '';
            el.appendChild(svg);
        });
    </script>
</body>

</html>